
package info.niwota.dc;

import android.app.Activity;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.view.Window;
import android.view.WindowManager;

/**
 * Settings for the Alarm Clock.
 */
public class SettingsActivity extends PreferenceActivity {

	// private static final int ALARM_STREAM_TYPE_BIT =
	// 1 << AudioManager.STREAM_ALARM;
	//    
	// private static final String KEY_ALARM_IN_SILENT_MODE =
	// "alarm_in_silent_mode";
	// private CheckBoxPreference mAlarmInSilentModePref;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_LEFT_ICON);
		
		super.onCreate(savedInstanceState);

		addPreferencesFromResource(R.xml.settings);
		
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setTitle(R.string.settings_label);
		getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
				R.drawable.icon);
		//
		setResult(Activity.RESULT_CANCELED);
		
	//	super.onCreate(savedInstanceState);

	//	addPreferencesFromResource(R.xml.settings);

		// mAlarmInSilentModePref =
		// (CheckBoxPreference) findPreference(KEY_ALARM_IN_SILENT_MODE);
	}

	@Override
	protected void onResume() {
		super.onResume();
		//refresh();
	}

	@Override
	public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
			Preference preference) {
		//        
		// if (preference == mAlarmInSilentModePref) {
		//            
		// int ringerModeStreamTypes = Settings.System.getInt(
		// getContentResolver(),
		// Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);
		//            
		// if (mAlarmInSilentModePref.isChecked()) {
		// ringerModeStreamTypes &= ~ALARM_STREAM_TYPE_BIT;
		// } else {
		// ringerModeStreamTypes |= ALARM_STREAM_TYPE_BIT;
		// }
		//            
		// Settings.System.putInt(getContentResolver(),
		// Settings.System.MODE_RINGER_STREAMS_AFFECTED,
		// ringerModeStreamTypes);
		//            
		// return true;
		// }

		return super.onPreferenceTreeClick(preferenceScreen, preference);
	}

	// private void refresh() {
	// int silentModeStreams = Settings.System.getInt(getContentResolver(),
	// Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);
	// mAlarmInSilentModePref.setChecked(
	// (silentModeStreams & ALARM_STREAM_TYPE_BIT) == 0);
	// }

}
